import java.io.*;
import javax.bluetooth.*;

public class LocalInfo {
	public static void main(String args[]) throws BluetoothStateException {
		LocalDevice localdev = null;

		try {
			localdev = LocalDevice.getLocalDevice();
		} catch (BluetoothStateException e) {
			System.out.println("ERROR: cannot access local device");
			System.exit(1);
		}

		System.out.println("a local bluetooth device is found:");
		System.out.println("   Name: " + localdev.getFriendlyName());
		System.out.println("Address: " + localdev.getBluetoothAddress());

		System.out.println("\nIts device classes are:");
		DeviceClass devcla = localdev.getDeviceClass();
		System.out.println(devcla.toString());
		System.out.println("Service Class: " + devcla.getServiceClasses());
		System.out.println("Major Device Class: "
				+ devcla.getMajorDeviceClass());
		System.out.println("Minor Device Class: "
				+ devcla.getMinorDeviceClass());
	}
}
